#ifndef ABSTRACTMETA_H
#define ABSTRACTMETA_H

#include "metadata.h"

#include <QObject>
#include <QSharedData>
#include <QSharedDataPointer>
#include <QExplicitlySharedDataPointer>
#include <QPointer>

class MetaField : public QObject
{
    Q_OBJECT

    class Data : public QSharedData
    {
        Data()
        {
            editable = true;
        }

        Data(const Data& other) : QSharedData(other)
        {
            name = other.name;
            editable = other.editable;
        }

        QString name;
        bool    editable;
    };

    Q_PROPERTY(QString name READ name WRITE setName)
    Q_PROPERTY(bool editable READ editable WRITE setEditable)

public:

    Q_INVOKABLE MetaField(MetaData *parent = 0);
    explicit MetaField(const QString& name, MetaData *parent = 0);
    MetaField(const MetaField& other);

    virtual QString name() const;
    virtual void setName(const QString& name);

    virtual bool editable() const;
    virtual void setEditable(bool editable);


private:

    QExplicitlySharedDataPointer<Data> d;
    

};


typedef QPointer<MetaField> MetaFieldPtr;


#endif // ABSTRACTMETA_H
